﻿// ----------------------------------------------------------------
// Description : 实体类,该文件由MyGeneration生成
// Author      : 
// Create date : 2010/4/6
// ----------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace ITOMMS.Entity
{
	/// <summary>
	///	SaleReportProcure Entity
	///	SaleReportProcure Entity
	/// </summary>
	[Serializable]
	public class SaleReportProcureEntity : BaseEntity<SaleReportProcureEntity,int>
	{
		
		#region 私有成员			
		
		private int _id; 
		private string _company; 
		private string _project; 
		private string _address; 
		private string _scope; 
		private string _tel; 
		private string _fax; 
		private string _mail; 
		private string _website; 
		private string _principal1; 
		private string _principal1_tel; 
		private string _principal1_mobile; 
		private string _principal1_mail; 
		private string _principal2; 
		private string _principal2_tel; 
		private string _principal2_mobile; 
		private string _principal2_mail; 
		private string _product_type; 
		private string _product_brand; 
		private string _product_name; 
		private string _product_model; 
		private string _product_unit; 
		private string _product_amount; 
		private string _product_scheme; 
		private string _other_require; 
		private string _other_plan; 
		private string _remark; 
		private string _responser; 
		private int? _salestatus; 
		private DateTime? _saledatedate; 
		private string _followup_1; 
		private DateTime? _followup_1_time; 
		private string _followup_1_user; 
		private string _followup_2; 
		private DateTime? _followup_2_time; 
		private string _followup_2_user; 
		private string _followup_3; 
		private DateTime? _followup_3_time; 
		private string _followup_3_user; 
		private string _followup_4; 
		private string _followup_4_time; 
		private string _followup_4_user; 
		private string _followup_5; 
		private DateTime? _followup_5_time; 
		private string _followup_5_user; 
		private string _CreateBy; 
		private DateTime? _CreateDate; 
		private int _SEQNO;
		#endregion


		
		#region 默认( 空 ) 构造函数
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public SaleReportProcureEntity()
		{
			_id = 0; 
			_company = String.Empty; 
			_project = String.Empty; 
			_address = String.Empty; 
			_scope = String.Empty; 
			_tel = String.Empty; 
			_fax = String.Empty; 
			_mail = String.Empty; 
			_website = String.Empty; 
			_principal1 = String.Empty; 
			_principal1_tel = String.Empty; 
			_principal1_mobile = String.Empty; 
			_principal1_mail = String.Empty; 
			_principal2 = String.Empty; 
			_principal2_tel = String.Empty; 
			_principal2_mobile = String.Empty; 
			_principal2_mail = String.Empty; 
			_product_type = String.Empty; 
			_product_brand = String.Empty; 
			_product_name = String.Empty; 
			_product_model = String.Empty; 
			_product_unit = String.Empty; 
			_product_amount = String.Empty; 
			_product_scheme = String.Empty; 
			_other_require = String.Empty; 
			_other_plan = String.Empty; 
			_remark = String.Empty; 
			_responser = String.Empty; 
			_salestatus =  null; 
			_saledatedate =  null; 
			_followup_1 = String.Empty; 
			_followup_1_time =  null; 
			_followup_1_user = String.Empty; 
			_followup_2 = String.Empty; 
			_followup_2_time =  null; 
			_followup_2_user = String.Empty; 
			_followup_3 = String.Empty; 
			_followup_3_time =  null; 
			_followup_3_user = String.Empty; 
			_followup_4 = String.Empty; 
			_followup_4_time = String.Empty; 
			_followup_4_user = String.Empty; 
			_followup_5 = String.Empty; 
			_followup_5_time =  null; 
			_followup_5_user = String.Empty; 
			_CreateBy = String.Empty; 
			_CreateDate =  null; 
			_SEQNO = 0;
		}
		#endregion
		
		#region 属性值校验
		
		/// <summary>
		/// 属性值校验
		/// </summary>
		public bool CheckValues()
		{
			bool bResult = true;
			string strError = "";
		
			if ( _id ==  0)
			{
				bResult = false;
				strError += "\r\n 非空值不能为: "+_id;
			}
			
			if( !bResult )
					throw new ArgumentOutOfRangeException(strError);
			return bResult;
			
		}
		
		#endregion
		
		
		
	
		#region Required Fields Only Constructor
		
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public SaleReportProcureEntity(
		int para_id		)
		: this()
		{
					_id = para_id;
			_company = String.Empty;
			_project = String.Empty;
			_address = String.Empty;
			_scope = String.Empty;
			_tel = String.Empty;
			_fax = String.Empty;
			_mail = String.Empty;
			_website = String.Empty;
			_principal1 = String.Empty;
			_principal1_tel = String.Empty;
			_principal1_mobile = String.Empty;
			_principal1_mail = String.Empty;
			_principal2 = String.Empty;
			_principal2_tel = String.Empty;
			_principal2_mobile = String.Empty;
			_principal2_mail = String.Empty;
			_product_type = String.Empty;
			_product_brand = String.Empty;
			_product_name = String.Empty;
			_product_model = String.Empty;
			_product_unit = String.Empty;
			_product_amount = String.Empty;
			_product_scheme = String.Empty;
			_other_require = String.Empty;
			_other_plan = String.Empty;
			_remark = String.Empty;
			_responser = String.Empty;
			_salestatus = null;
			_saledatedate = null;
			_followup_1 = String.Empty;
			_followup_1_time = null;
			_followup_1_user = String.Empty;
			_followup_2 = String.Empty;
			_followup_2_time = null;
			_followup_2_user = String.Empty;
			_followup_3 = String.Empty;
			_followup_3_time = null;
			_followup_3_user = String.Empty;
			_followup_4 = String.Empty;
			_followup_4_time = String.Empty;
			_followup_4_user = String.Empty;
			_followup_5 = String.Empty;
			_followup_5_time = null;
			_followup_5_user = String.Empty;
			_CreateBy = String.Empty;
			_CreateDate = null;
		}
		#endregion 

		
		#region 公有属性
			
			/// <summary>
			/// 行号，顺序号。系统默认的属性,对这个属性不要作操作.属性值在架构中已经处理
			/// </summary>
			public virtual int SEQNO
			{
				get { return _SEQNO; }
				set { _SEQNO = value; }
			}
		
			
		/// <summary>
		/// id
		/// </summary>		
		public virtual int id
		{
			get { return _id; }
			set { _id = value; }
		}
			
		/// <summary>
		/// company
		/// </summary>		
		public virtual string company
		{
			get { return _company; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for company", value, value.ToString());
				
				_company = value;
			}
		}
			
		/// <summary>
		/// project
		/// </summary>		
		public virtual string project
		{
			get { return _project; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for project", value, value.ToString());
				
				_project = value;
			}
		}
			
		/// <summary>
		/// address
		/// </summary>		
		public virtual string address
		{
			get { return _address; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for address", value, value.ToString());
				
				_address = value;
			}
		}
			
		/// <summary>
		/// scope
		/// </summary>		
		public virtual string scope
		{
			get { return _scope; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for scope", value, value.ToString());
				
				_scope = value;
			}
		}
			
		/// <summary>
		/// tel
		/// </summary>		
		public virtual string tel
		{
			get { return _tel; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for tel", value, value.ToString());
				
				_tel = value;
			}
		}
			
		/// <summary>
		/// fax
		/// </summary>		
		public virtual string fax
		{
			get { return _fax; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for fax", value, value.ToString());
				
				_fax = value;
			}
		}
			
		/// <summary>
		/// mail
		/// </summary>		
		public virtual string mail
		{
			get { return _mail; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for mail", value, value.ToString());
				
				_mail = value;
			}
		}
			
		/// <summary>
		/// website
		/// </summary>		
		public virtual string website
		{
			get { return _website; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 100)
						throw new ArgumentOutOfRangeException("Invalid value for website", value, value.ToString());
				
				_website = value;
			}
		}
			
		/// <summary>
		/// principal1
		/// </summary>		
		public virtual string principal1
		{
			get { return _principal1; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for principal1", value, value.ToString());
				
				_principal1 = value;
			}
		}
			
		/// <summary>
		/// principal1_tel
		/// </summary>		
		public virtual string principal1_tel
		{
			get { return _principal1_tel; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for principal1_tel", value, value.ToString());
				
				_principal1_tel = value;
			}
		}
			
		/// <summary>
		/// principal1_mobile
		/// </summary>		
		public virtual string principal1_mobile
		{
			get { return _principal1_mobile; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for principal1_mobile", value, value.ToString());
				
				_principal1_mobile = value;
			}
		}
			
		/// <summary>
		/// principal1_mail
		/// </summary>		
		public virtual string principal1_mail
		{
			get { return _principal1_mail; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for principal1_mail", value, value.ToString());
				
				_principal1_mail = value;
			}
		}
			
		/// <summary>
		/// principal2
		/// </summary>		
		public virtual string principal2
		{
			get { return _principal2; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for principal2", value, value.ToString());
				
				_principal2 = value;
			}
		}
			
		/// <summary>
		/// principal2_tel
		/// </summary>		
		public virtual string principal2_tel
		{
			get { return _principal2_tel; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for principal2_tel", value, value.ToString());
				
				_principal2_tel = value;
			}
		}
			
		/// <summary>
		/// principal2_mobile
		/// </summary>		
		public virtual string principal2_mobile
		{
			get { return _principal2_mobile; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for principal2_mobile", value, value.ToString());
				
				_principal2_mobile = value;
			}
		}
			
		/// <summary>
		/// principal2_mail
		/// </summary>		
		public virtual string principal2_mail
		{
			get { return _principal2_mail; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for principal2_mail", value, value.ToString());
				
				_principal2_mail = value;
			}
		}
			
		/// <summary>
		/// product_type
		/// </summary>		
		public virtual string product_type
		{
			get { return _product_type; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for product_type", value, value.ToString());
				
				_product_type = value;
			}
		}
			
		/// <summary>
		/// product_brand
		/// </summary>		
		public virtual string product_brand
		{
			get { return _product_brand; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for product_brand", value, value.ToString());
				
				_product_brand = value;
			}
		}
			
		/// <summary>
		/// product_name
		/// </summary>		
		public virtual string product_name
		{
			get { return _product_name; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for product_name", value, value.ToString());
				
				_product_name = value;
			}
		}
			
		/// <summary>
		/// product_model
		/// </summary>		
		public virtual string product_model
		{
			get { return _product_model; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for product_model", value, value.ToString());
				
				_product_model = value;
			}
		}
			
		/// <summary>
		/// product_unit
		/// </summary>		
		public virtual string product_unit
		{
			get { return _product_unit; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for product_unit", value, value.ToString());
				
				_product_unit = value;
			}
		}
			
		/// <summary>
		/// product_amount
		/// </summary>		
		public virtual string product_amount
		{
			get { return _product_amount; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for product_amount", value, value.ToString());
				
				_product_amount = value;
			}
		}
			
		/// <summary>
		/// product_scheme
		/// </summary>		
		public virtual string product_scheme
		{
			get { return _product_scheme; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 500)
						throw new ArgumentOutOfRangeException("Invalid value for product_scheme", value, value.ToString());
				
				_product_scheme = value;
			}
		}
			
		/// <summary>
		/// other_require
		/// </summary>		
		public virtual string other_require
		{
			get { return _other_require; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 3000)
						throw new ArgumentOutOfRangeException("Invalid value for other_require", value, value.ToString());
				
				_other_require = value;
			}
		}
			
		/// <summary>
		/// other_plan
		/// </summary>		
		public virtual string other_plan
		{
			get { return _other_plan; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 500)
						throw new ArgumentOutOfRangeException("Invalid value for other_plan", value, value.ToString());
				
				_other_plan = value;
			}
		}
			
		/// <summary>
		/// remark
		/// </summary>		
		public virtual string remark
		{
			get { return _remark; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 500)
						throw new ArgumentOutOfRangeException("Invalid value for remark", value, value.ToString());
				
				_remark = value;
			}
		}
			
		/// <summary>
		/// responser
		/// </summary>		
		public virtual string responser
		{
			get { return _responser; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for responser", value, value.ToString());
				
				_responser = value;
			}
		}
			
		/// <summary>
		/// salestatus
		/// </summary>		
		public virtual int? salestatus
		{
			get { return _salestatus; }
			set { _salestatus = value; }
		}
			
		/// <summary>
		/// saledatedate
		/// </summary>		
		public virtual DateTime? saledatedate
		{
			get { return _saledatedate; }
			set { _saledatedate = value; }
		}
			
		/// <summary>
		/// followup_1
		/// </summary>		
		public virtual string followup_1
		{
			get { return _followup_1; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 500)
						throw new ArgumentOutOfRangeException("Invalid value for followup_1", value, value.ToString());
				
				_followup_1 = value;
			}
		}
			
		/// <summary>
		/// followup_1_time
		/// </summary>		
		public virtual DateTime? followup_1_time
		{
			get { return _followup_1_time; }
			set { _followup_1_time = value; }
		}
			
		/// <summary>
		/// followup_1_user
		/// </summary>		
		public virtual string followup_1_user
		{
			get { return _followup_1_user; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for followup_1_user", value, value.ToString());
				
				_followup_1_user = value;
			}
		}
			
		/// <summary>
		/// followup_2
		/// </summary>		
		public virtual string followup_2
		{
			get { return _followup_2; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 500)
						throw new ArgumentOutOfRangeException("Invalid value for followup_2", value, value.ToString());
				
				_followup_2 = value;
			}
		}
			
		/// <summary>
		/// followup_2_time
		/// </summary>		
		public virtual DateTime? followup_2_time
		{
			get { return _followup_2_time; }
			set { _followup_2_time = value; }
		}
			
		/// <summary>
		/// followup_2_user
		/// </summary>		
		public virtual string followup_2_user
		{
			get { return _followup_2_user; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for followup_2_user", value, value.ToString());
				
				_followup_2_user = value;
			}
		}
			
		/// <summary>
		/// followup_3
		/// </summary>		
		public virtual string followup_3
		{
			get { return _followup_3; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 500)
						throw new ArgumentOutOfRangeException("Invalid value for followup_3", value, value.ToString());
				
				_followup_3 = value;
			}
		}
			
		/// <summary>
		/// followup_3_time
		/// </summary>		
		public virtual DateTime? followup_3_time
		{
			get { return _followup_3_time; }
			set { _followup_3_time = value; }
		}
			
		/// <summary>
		/// followup_3_user
		/// </summary>		
		public virtual string followup_3_user
		{
			get { return _followup_3_user; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for followup_3_user", value, value.ToString());
				
				_followup_3_user = value;
			}
		}
			
		/// <summary>
		/// followup_4
		/// </summary>		
		public virtual string followup_4
		{
			get { return _followup_4; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 500)
						throw new ArgumentOutOfRangeException("Invalid value for followup_4", value, value.ToString());
				
				_followup_4 = value;
			}
		}
			
		/// <summary>
		/// followup_4_time
		/// </summary>		
		public virtual string followup_4_time
		{
			get { return _followup_4_time; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for followup_4_time", value, value.ToString());
				
				_followup_4_time = value;
			}
		}
			
		/// <summary>
		/// followup_4_user
		/// </summary>		
		public virtual string followup_4_user
		{
			get { return _followup_4_user; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for followup_4_user", value, value.ToString());
				
				_followup_4_user = value;
			}
		}
			
		/// <summary>
		/// followup_5
		/// </summary>		
		public virtual string followup_5
		{
			get { return _followup_5; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 500)
						throw new ArgumentOutOfRangeException("Invalid value for followup_5", value, value.ToString());
				
				_followup_5 = value;
			}
		}
			
		/// <summary>
		/// followup_5_time
		/// </summary>		
		public virtual DateTime? followup_5_time
		{
			get { return _followup_5_time; }
			set { _followup_5_time = value; }
		}
			
		/// <summary>
		/// followup_5_user
		/// </summary>		
		public virtual string followup_5_user
		{
			get { return _followup_5_user; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for followup_5_user", value, value.ToString());
				
				_followup_5_user = value;
			}
		}
			
		/// <summary>
		/// CreateBy
		/// </summary>		
		public virtual string CreateBy
		{
			get { return _CreateBy; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for CreateBy", value, value.ToString());
				
				_CreateBy = value;
			}
		}
			
		/// <summary>
		/// CreateDate
		/// </summary>		
		public virtual DateTime? CreateDate
		{
			get { return _CreateDate; }
			set { _CreateDate = value; }
		}
			


		#endregion 	
		
		
        #region DAO操作
		
		
		/// <summary>
        /// 获取所有实体的列表
        /// </summary>
        /// <returns></returns>
        public override List<SaleReportProcureEntity> GetAll()
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [id],[company],[project],[address],[scope],[tel],[fax],[mail],[website],[principal1],[principal1_tel],[principal1_mobile],[principal1_mail],[principal2],[principal2_tel],[principal2_mobile],[principal2_mail],[product_type],[product_brand],[product_name],[product_model],[product_unit],[product_amount],[product_scheme],[other_require],[other_plan],[remark],[responser],[salestatus],[saledatedate],[followup_1],[followup_1_time],[followup_1_user],[followup_2],[followup_2_time],[followup_2_user],[followup_3],[followup_3_time],[followup_3_user],[followup_4],[followup_4_time],[followup_4_user],[followup_5],[followup_5_time],[followup_5_user],[CreateBy],[CreateDate] from [Sale_Report_Procure] ");
	
            List<SaleReportProcureEntity> list = new List<SaleReportProcureEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq = 0;
                while (dataReader.Read())
                {	seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		/// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords()
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("  select count([id])  from [Sale_Report_Procure] ");
	
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }
		
		/// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords(string sqlCondition)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("  select count([id])  from [Sale_Report_Procure]  ");
	
			 if (sqlCondition.Trim() != "")
            {
                strSql.Append(" where " + sqlCondition);
            }
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }	
		
		
		/// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
		/// <param name="PageSize">每页大小</param>
		/// <param name="CurrentPageIndex">当前页码</param>
        /// <returns></returns>
		 public override List<SaleReportProcureEntity> GetAllByQuery(string strWhere, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }
		 
			strSql.Append("select top ").Append(PageSize).Append("  [id],[company],[project],[address],[scope],[tel],[fax],[mail],[website],[principal1],[principal1_tel],[principal1_mobile],[principal1_mail],[principal2],[principal2_tel],[principal2_mobile],[principal2_mail],[product_type],[product_brand],[product_name],[product_model],[product_unit],[product_amount],[product_scheme],[other_require],[other_plan],[remark],[responser],[salestatus],[saledatedate],[followup_1],[followup_1_time],[followup_1_user],[followup_2],[followup_2_time],[followup_2_user],[followup_3],[followup_3_time],[followup_3_user],[followup_4],[followup_4_time],[followup_4_user],[followup_5],[followup_5_time],[followup_5_user],[CreateBy],[CreateDate] from [Sale_Report_Procure] where ");

			 if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
			  strSql.Append(" ID not in ( ");
			 strSql.Append(" select top ").Append(PageSize*(CurrentPageIndex-1)).Append("  [id] from [Sale_Report_Procure] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere );
            }
			strSql.Append(" ) " );

            List<SaleReportProcureEntity> list = new List<SaleReportProcureEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
			   int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }
		
		
			/// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
		/// <param name="PageSize">每页大小</param>
		/// <param name="CurrentPageIndex">当前页码</param>
		/// <param name="strSort">ex:order by id desc</param>
        /// <returns></returns>
		 public override List<SaleReportProcureEntity> GetAllByQuery(string strWhere,string strSort, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }
		 
			strSql.Append("select top ").Append(PageSize).Append("  [id],[company],[project],[address],[scope],[tel],[fax],[mail],[website],[principal1],[principal1_tel],[principal1_mobile],[principal1_mail],[principal2],[principal2_tel],[principal2_mobile],[principal2_mail],[product_type],[product_brand],[product_name],[product_model],[product_unit],[product_amount],[product_scheme],[other_require],[other_plan],[remark],[responser],[salestatus],[saledatedate],[followup_1],[followup_1_time],[followup_1_user],[followup_2],[followup_2_time],[followup_2_user],[followup_3],[followup_3_time],[followup_3_user],[followup_4],[followup_4_time],[followup_4_user],[followup_5],[followup_5_time],[followup_5_user],[CreateBy],[CreateDate] from [Sale_Report_Procure] where ");

			 if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
			  strSql.Append(" ID not in ( ");
			 strSql.Append(" select top ").Append(PageSize*(CurrentPageIndex-1)).Append("  [id] from [Sale_Report_Procure] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere+" " ).Append(strSort);
            }
			strSql.Append(" ) " ).Append(strSort);

            List<SaleReportProcureEntity> list = new List<SaleReportProcureEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {	
					seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }
		
		
		/// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public override List<SaleReportProcureEntity> GetAllByQuery(string strWhere)
        {
			strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [id],[company],[project],[address],[scope],[tel],[fax],[mail],[website],[principal1],[principal1_tel],[principal1_mobile],[principal1_mail],[principal2],[principal2_tel],[principal2_mobile],[principal2_mail],[product_type],[product_brand],[product_name],[product_model],[product_unit],[product_amount],[product_scheme],[other_require],[other_plan],[remark],[responser],[salestatus],[saledatedate],[followup_1],[followup_1_time],[followup_1_user],[followup_2],[followup_2_time],[followup_2_user],[followup_3],[followup_3_time],[followup_3_user],[followup_4],[followup_4_time],[followup_4_user],[followup_5],[followup_5_time],[followup_5_user],[CreateBy],[CreateDate] from Sale_Report_Procure ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<SaleReportProcureEntity> list = new List<SaleReportProcureEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            { 
				int seq = 0;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		
		/// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
		/// <param name="parameters">sql条件中的参数</param>
        /// <returns></returns>
        public override List<SaleReportProcureEntity> GetAllByQuery(string strWhere, List<IDataParameter> parameters)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [id],[company],[project],[address],[scope],[tel],[fax],[mail],[website],[principal1],[principal1_tel],[principal1_mobile],[principal1_mail],[principal2],[principal2_tel],[principal2_mobile],[principal2_mail],[product_type],[product_brand],[product_name],[product_model],[product_unit],[product_amount],[product_scheme],[other_require],[other_plan],[remark],[responser],[salestatus],[saledatedate],[followup_1],[followup_1_time],[followup_1_user],[followup_2],[followup_2_time],[followup_2_user],[followup_3],[followup_3_time],[followup_3_user],[followup_4],[followup_4_time],[followup_4_user],[followup_5],[followup_5_time],[followup_5_user],[CreateBy],[CreateDate] from [Sale_Report_Procure] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<SaleReportProcureEntity> list = new List<SaleReportProcureEntity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
				int seq =0 ;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		

		
		
		/// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<SaleReportProcureEntity> GetAllByQuery(string strWhere, List<IDataParameter> parameters, int rowNumber)
        {

            StringBuilder strSql = new StringBuilder();
			strSql.Append("select top ").Append(rowNumber).Append("  [id],[company],[project],[address],[scope],[tel],[fax],[mail],[website],[principal1],[principal1_tel],[principal1_mobile],[principal1_mail],[principal2],[principal2_tel],[principal2_mobile],[principal2_mail],[product_type],[product_brand],[product_name],[product_model],[product_unit],[product_amount],[product_scheme],[other_require],[other_plan],[remark],[responser],[salestatus],[saledatedate],[followup_1],[followup_1_time],[followup_1_user],[followup_2],[followup_2_time],[followup_2_user],[followup_3],[followup_3_time],[followup_3_user],[followup_4],[followup_4_time],[followup_4_user],[followup_5],[followup_5_time],[followup_5_user],[CreateBy],[CreateDate] from [Sale_Report_Procure] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<SaleReportProcureEntity> list = new List<SaleReportProcureEntity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {	
				int seq = 0;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		/// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句: AND AA=@AA</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<SaleReportProcureEntity> GetAllByQuery(string strWhere, int rowNumber)
        {
		    strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
			
			strSql.Append("select top ").Append(rowNumber).Append("  [id],[company],[project],[address],[scope],[tel],[fax],[mail],[website],[principal1],[principal1_tel],[principal1_mobile],[principal1_mail],[principal2],[principal2_tel],[principal2_mobile],[principal2_mail],[product_type],[product_brand],[product_name],[product_model],[product_unit],[product_amount],[product_scheme],[other_require],[other_plan],[remark],[responser],[salestatus],[saledatedate],[followup_1],[followup_1_time],[followup_1_user],[followup_2],[followup_2_time],[followup_2_user],[followup_3],[followup_3_time],[followup_3_user],[followup_4],[followup_4_time],[followup_4_user],[followup_5],[followup_5_time],[followup_5_user],[CreateBy],[CreateDate] from [Sale_Report_Procure] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where  " + strWhere);
            }
            List<SaleReportProcureEntity> list = new List<SaleReportProcureEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq=0;
                while (dataReader.Read())
                {	
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		
		
		
		
		
        /// <summary>
        /// 按主键查询对应的实体
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
        public override SaleReportProcureEntity GetById(int id)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [id],[company],[project],[address],[scope],[tel],[fax],[mail],[website],[principal1],[principal1_tel],[principal1_mobile],[principal1_mail],[principal2],[principal2_tel],[principal2_mobile],[principal2_mail],[product_type],[product_brand],[product_name],[product_model],[product_unit],[product_amount],[product_scheme],[other_require],[other_plan],[remark],[responser],[salestatus],[saledatedate],[followup_1],[followup_1_time],[followup_1_user],[followup_2],[followup_2_time],[followup_2_user],[followup_3],[followup_3_time],[followup_3_user],[followup_4],[followup_4_time],[followup_4_user],[followup_5],[followup_5_time],[followup_5_user],[CreateBy],[CreateDate] from [Sale_Report_Procure]  where id= @id ");
				
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "id", DbType.Int32, id);
            SaleReportProcureEntity entity = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    entity = ReaderBind(dataReader);
                }
            }
            return entity;

        }
		
		
		 /// <summary>
        /// 保存实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override int Save()
        {
			
            if (this.id ==0)
            {
                this.id = GetMax("Sale_Report_Procure");
            }
            StringBuilder strSql = new StringBuilder();
			strSql.Append("insert into  Sale_Report_Procure (");
			strSql.Append("[id],[company],[project],[address],[scope],[tel],[fax],[mail],[website],[principal1],[principal1_tel],[principal1_mobile],[principal1_mail],[principal2],[principal2_tel],[principal2_mobile],[principal2_mail],[product_type],[product_brand],[product_name],[product_model],[product_unit],[product_amount],[product_scheme],[other_require],[other_plan],[remark],[responser],[salestatus],[saledatedate],[followup_1],[followup_1_time],[followup_1_user],[followup_2],[followup_2_time],[followup_2_user],[followup_3],[followup_3_time],[followup_3_user],[followup_4],[followup_4_time],[followup_4_user],[followup_5],[followup_5_time],[followup_5_user],[CreateBy],[CreateDate] )");
			strSql.Append(" values (");
			strSql.Append("@id,@company,@project,@address,@scope,@tel,@fax,@mail,@website,@principal1,@principal1_tel,@principal1_mobile,@principal1_mail,@principal2,@principal2_tel,@principal2_mobile,@principal2_mail,@product_type,@product_brand,@product_name,@product_model,@product_unit,@product_amount,@product_scheme,@other_require,@other_plan,@remark,@responser,@salestatus,@saledatedate,@followup_1,@followup_1_time,@followup_1_user,@followup_2,@followup_2_time,@followup_2_user,@followup_3,@followup_3_time,@followup_3_user,@followup_4,@followup_4_time,@followup_4_user,@followup_5,@followup_5_time,@followup_5_user,@CreateBy,@CreateDate)");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "id", DbType.Int32, this.id);
			db.AddInParameter(dbCommand, "company", DbType.String, this.company);
			db.AddInParameter(dbCommand, "project", DbType.String, this.project);
			db.AddInParameter(dbCommand, "address", DbType.String, this.address);
			db.AddInParameter(dbCommand, "scope", DbType.String, this.scope);
			db.AddInParameter(dbCommand, "tel", DbType.String, this.tel);
			db.AddInParameter(dbCommand, "fax", DbType.String, this.fax);
			db.AddInParameter(dbCommand, "mail", DbType.String, this.mail);
			db.AddInParameter(dbCommand, "website", DbType.String, this.website);
			db.AddInParameter(dbCommand, "principal1", DbType.String, this.principal1);
			db.AddInParameter(dbCommand, "principal1_tel", DbType.String, this.principal1_tel);
			db.AddInParameter(dbCommand, "principal1_mobile", DbType.String, this.principal1_mobile);
			db.AddInParameter(dbCommand, "principal1_mail", DbType.String, this.principal1_mail);
			db.AddInParameter(dbCommand, "principal2", DbType.String, this.principal2);
			db.AddInParameter(dbCommand, "principal2_tel", DbType.String, this.principal2_tel);
			db.AddInParameter(dbCommand, "principal2_mobile", DbType.String, this.principal2_mobile);
			db.AddInParameter(dbCommand, "principal2_mail", DbType.String, this.principal2_mail);
			db.AddInParameter(dbCommand, "product_type", DbType.String, this.product_type);
			db.AddInParameter(dbCommand, "product_brand", DbType.String, this.product_brand);
			db.AddInParameter(dbCommand, "product_name", DbType.String, this.product_name);
			db.AddInParameter(dbCommand, "product_model", DbType.String, this.product_model);
			db.AddInParameter(dbCommand, "product_unit", DbType.String, this.product_unit);
			db.AddInParameter(dbCommand, "product_amount", DbType.String, this.product_amount);
			db.AddInParameter(dbCommand, "product_scheme", DbType.String, this.product_scheme);
			db.AddInParameter(dbCommand, "other_require", DbType.String, this.other_require);
			db.AddInParameter(dbCommand, "other_plan", DbType.String, this.other_plan);
			db.AddInParameter(dbCommand, "remark", DbType.String, this.remark);
			db.AddInParameter(dbCommand, "responser", DbType.String, this.responser);
			if (this.salestatus == null)
			{
			db.AddInParameter(dbCommand, "salestatus", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "salestatus", DbType.Int32, this.salestatus.Value);
			}
			if (this.saledatedate == null)
			{
			db.AddInParameter(dbCommand, "saledatedate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "saledatedate", DbType.DateTime, this.saledatedate.Value);
			}
			db.AddInParameter(dbCommand, "followup_1", DbType.String, this.followup_1);
			if (this.followup_1_time == null)
			{
			db.AddInParameter(dbCommand, "followup_1_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_1_time", DbType.DateTime, this.followup_1_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_1_user", DbType.String, this.followup_1_user);
			db.AddInParameter(dbCommand, "followup_2", DbType.String, this.followup_2);
			if (this.followup_2_time == null)
			{
			db.AddInParameter(dbCommand, "followup_2_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_2_time", DbType.DateTime, this.followup_2_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_2_user", DbType.String, this.followup_2_user);
			db.AddInParameter(dbCommand, "followup_3", DbType.String, this.followup_3);
			if (this.followup_3_time == null)
			{
			db.AddInParameter(dbCommand, "followup_3_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_3_time", DbType.DateTime, this.followup_3_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_3_user", DbType.String, this.followup_3_user);
			db.AddInParameter(dbCommand, "followup_4", DbType.String, this.followup_4);
			db.AddInParameter(dbCommand, "followup_4_time", DbType.String, this.followup_4_time);
			db.AddInParameter(dbCommand, "followup_4_user", DbType.String, this.followup_4_user);
			db.AddInParameter(dbCommand, "followup_5", DbType.String, this.followup_5);
			if (this.followup_5_time == null)
			{
			db.AddInParameter(dbCommand, "followup_5_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_5_time", DbType.DateTime, this.followup_5_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_5_user", DbType.String, this.followup_5_user);
			db.AddInParameter(dbCommand, "CreateBy", DbType.String, this.CreateBy);
			if (this.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, this.CreateDate.Value);
			}

			return db.ExecuteNonQuery(dbCommand);
		  
      
        }
		

		
        /// <summary>
        /// 保存实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override int Save(SaleReportProcureEntity entity)
        {
			
            if (entity.id == 0)
            {
                entity.id = GetMax("Sale_Report_Procure");
            }
            StringBuilder strSql = new StringBuilder();
			strSql.Append("insert into  Sale_Report_Procure (");
			strSql.Append("[id],[company],[project],[address],[scope],[tel],[fax],[mail],[website],[principal1],[principal1_tel],[principal1_mobile],[principal1_mail],[principal2],[principal2_tel],[principal2_mobile],[principal2_mail],[product_type],[product_brand],[product_name],[product_model],[product_unit],[product_amount],[product_scheme],[other_require],[other_plan],[remark],[responser],[salestatus],[saledatedate],[followup_1],[followup_1_time],[followup_1_user],[followup_2],[followup_2_time],[followup_2_user],[followup_3],[followup_3_time],[followup_3_user],[followup_4],[followup_4_time],[followup_4_user],[followup_5],[followup_5_time],[followup_5_user],[CreateBy],[CreateDate] )");
			strSql.Append(" values (");
			strSql.Append("@id,@company,@project,@address,@scope,@tel,@fax,@mail,@website,@principal1,@principal1_tel,@principal1_mobile,@principal1_mail,@principal2,@principal2_tel,@principal2_mobile,@principal2_mail,@product_type,@product_brand,@product_name,@product_model,@product_unit,@product_amount,@product_scheme,@other_require,@other_plan,@remark,@responser,@salestatus,@saledatedate,@followup_1,@followup_1_time,@followup_1_user,@followup_2,@followup_2_time,@followup_2_user,@followup_3,@followup_3_time,@followup_3_user,@followup_4,@followup_4_time,@followup_4_user,@followup_5,@followup_5_time,@followup_5_user,@CreateBy,@CreateDate)");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "id", DbType.Int32, entity.id);
			db.AddInParameter(dbCommand, "company", DbType.String, entity.company);
			db.AddInParameter(dbCommand, "project", DbType.String, entity.project);
			db.AddInParameter(dbCommand, "address", DbType.String, entity.address);
			db.AddInParameter(dbCommand, "scope", DbType.String, entity.scope);
			db.AddInParameter(dbCommand, "tel", DbType.String, entity.tel);
			db.AddInParameter(dbCommand, "fax", DbType.String, entity.fax);
			db.AddInParameter(dbCommand, "mail", DbType.String, entity.mail);
			db.AddInParameter(dbCommand, "website", DbType.String, entity.website);
			db.AddInParameter(dbCommand, "principal1", DbType.String, entity.principal1);
			db.AddInParameter(dbCommand, "principal1_tel", DbType.String, entity.principal1_tel);
			db.AddInParameter(dbCommand, "principal1_mobile", DbType.String, entity.principal1_mobile);
			db.AddInParameter(dbCommand, "principal1_mail", DbType.String, entity.principal1_mail);
			db.AddInParameter(dbCommand, "principal2", DbType.String, entity.principal2);
			db.AddInParameter(dbCommand, "principal2_tel", DbType.String, entity.principal2_tel);
			db.AddInParameter(dbCommand, "principal2_mobile", DbType.String, entity.principal2_mobile);
			db.AddInParameter(dbCommand, "principal2_mail", DbType.String, entity.principal2_mail);
			db.AddInParameter(dbCommand, "product_type", DbType.String, entity.product_type);
			db.AddInParameter(dbCommand, "product_brand", DbType.String, entity.product_brand);
			db.AddInParameter(dbCommand, "product_name", DbType.String, entity.product_name);
			db.AddInParameter(dbCommand, "product_model", DbType.String, entity.product_model);
			db.AddInParameter(dbCommand, "product_unit", DbType.String, entity.product_unit);
			db.AddInParameter(dbCommand, "product_amount", DbType.String, entity.product_amount);
			db.AddInParameter(dbCommand, "product_scheme", DbType.String, entity.product_scheme);
			db.AddInParameter(dbCommand, "other_require", DbType.String, entity.other_require);
			db.AddInParameter(dbCommand, "other_plan", DbType.String, entity.other_plan);
			db.AddInParameter(dbCommand, "remark", DbType.String, entity.remark);
			db.AddInParameter(dbCommand, "responser", DbType.String, entity.responser);
			if (entity.salestatus == null)
			{
			db.AddInParameter(dbCommand, "salestatus", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "salestatus", DbType.Int32, entity.salestatus.Value);
			}
			if (entity.saledatedate == null)
			{
			db.AddInParameter(dbCommand, "saledatedate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "saledatedate", DbType.DateTime, entity.saledatedate.Value);
			}
			db.AddInParameter(dbCommand, "followup_1", DbType.String, entity.followup_1);
			if (entity.followup_1_time == null)
			{
			db.AddInParameter(dbCommand, "followup_1_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_1_time", DbType.DateTime, entity.followup_1_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_1_user", DbType.String, entity.followup_1_user);
			db.AddInParameter(dbCommand, "followup_2", DbType.String, entity.followup_2);
			if (entity.followup_2_time == null)
			{
			db.AddInParameter(dbCommand, "followup_2_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_2_time", DbType.DateTime, entity.followup_2_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_2_user", DbType.String, entity.followup_2_user);
			db.AddInParameter(dbCommand, "followup_3", DbType.String, entity.followup_3);
			if (entity.followup_3_time == null)
			{
			db.AddInParameter(dbCommand, "followup_3_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_3_time", DbType.DateTime, entity.followup_3_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_3_user", DbType.String, entity.followup_3_user);
			db.AddInParameter(dbCommand, "followup_4", DbType.String, entity.followup_4);
			db.AddInParameter(dbCommand, "followup_4_time", DbType.String, entity.followup_4_time);
			db.AddInParameter(dbCommand, "followup_4_user", DbType.String, entity.followup_4_user);
			db.AddInParameter(dbCommand, "followup_5", DbType.String, entity.followup_5);
			if (entity.followup_5_time == null)
			{
			db.AddInParameter(dbCommand, "followup_5_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_5_time", DbType.DateTime, entity.followup_5_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_5_user", DbType.String, entity.followup_5_user);
			db.AddInParameter(dbCommand, "CreateBy", DbType.String, entity.CreateBy);
			if (entity.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, entity.CreateDate.Value);
			}

			return db.ExecuteNonQuery(dbCommand);
		  
      
        }
		
		
        /// <summary>
        /// 保存或者更新(如果传入的实体主键为空则保存,否则做更新操作)
        /// </summary>
        /// <param name="entity">传入的实体</param>
        /// <returns>影响的行数</returns>
        public override int SaveOrUpdate(SaleReportProcureEntity entity)
        {
			
            if (entity.id  == 0)
            {
                if (Save(entity)>0)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return Update(entity);
            }
        }
		
		/// <summary>
        /// 保存或者更新(如果传入的实体主键为空则保存,否则做更新操作)
        /// </summary>
        /// <param name="entity">传入的实体</param>
        /// <returns>影响的行数</returns>
        public override int SaveOrUpdate()
        {
		
            if (this.id  == 0)
            {
                if (Save()>0)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return Update();
            }
        }
		
		/// <summary>
        /// 是否存在对应主键ID的记录
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public override bool IsExist(int ID)
        {
            Database db = GetDatabase();
            StringBuilder strSql = new StringBuilder();
            			 strSql.Append("select count(1) from Sale_Report_Procure where id=@id ");

            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "id", DbType.Int32, ID);//这里为ID是因为原有代码把主键都变成了ID.
            int cmdresult;
            object obj = db.ExecuteScalar(dbCommand);
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
		
		
		/// <summary>
        /// 删除对应的实体
        /// </summary>
        /// <param name="entity"></param>
        public override int Delete(SaleReportProcureEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete Sale_Report_Procure ");
            strSql.Append(" where id=@id ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "id", DbType.Int32, entity.id );
            return db.ExecuteNonQuery(dbCommand);
        }
		
		/// <summary>
        /// 删除主键ID对应的记录
        /// </summary>
        /// <param name="id"></param>
        public override int Delete(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete Sale_Report_Procure ");
            strSql.Append(" where id=@id ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "id", DbType.Int32, id);
            return db.ExecuteNonQuery(dbCommand);
        }
		
		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public override int Update()
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update Sale_Report_Procure set ");
			strSql.Append("[id]=@id,[company]=@company,[project]=@project,[address]=@address,[scope]=@scope,[tel]=@tel,[fax]=@fax,[mail]=@mail,[website]=@website,[principal1]=@principal1,[principal1_tel]=@principal1_tel,[principal1_mobile]=@principal1_mobile,[principal1_mail]=@principal1_mail,[principal2]=@principal2,[principal2_tel]=@principal2_tel,[principal2_mobile]=@principal2_mobile,[principal2_mail]=@principal2_mail,[product_type]=@product_type,[product_brand]=@product_brand,[product_name]=@product_name,[product_model]=@product_model,[product_unit]=@product_unit,[product_amount]=@product_amount,[product_scheme]=@product_scheme,[other_require]=@other_require,[other_plan]=@other_plan,[remark]=@remark,[responser]=@responser,[salestatus]=@salestatus,[saledatedate]=@saledatedate,[followup_1]=@followup_1,[followup_1_time]=@followup_1_time,[followup_1_user]=@followup_1_user,[followup_2]=@followup_2,[followup_2_time]=@followup_2_time,[followup_2_user]=@followup_2_user,[followup_3]=@followup_3,[followup_3_time]=@followup_3_time,[followup_3_user]=@followup_3_user,[followup_4]=@followup_4,[followup_4_time]=@followup_4_time,[followup_4_user]=@followup_4_user,[followup_5]=@followup_5,[followup_5_time]=@followup_5_time,[followup_5_user]=@followup_5_user,[CreateBy]=@CreateBy,[CreateDate]=@CreateDate ");

            strSql.Append(" where id=@id ");
            Database db = GetDatabase();
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "id", DbType.Int32, this.id );
			db.AddInParameter(dbCommand, "company", DbType.String, this.company);
			db.AddInParameter(dbCommand, "project", DbType.String, this.project);
			db.AddInParameter(dbCommand, "address", DbType.String, this.address);
			db.AddInParameter(dbCommand, "scope", DbType.String, this.scope);
			db.AddInParameter(dbCommand, "tel", DbType.String, this.tel);
			db.AddInParameter(dbCommand, "fax", DbType.String, this.fax);
			db.AddInParameter(dbCommand, "mail", DbType.String, this.mail);
			db.AddInParameter(dbCommand, "website", DbType.String, this.website);
			db.AddInParameter(dbCommand, "principal1", DbType.String, this.principal1);
			db.AddInParameter(dbCommand, "principal1_tel", DbType.String, this.principal1_tel);
			db.AddInParameter(dbCommand, "principal1_mobile", DbType.String, this.principal1_mobile);
			db.AddInParameter(dbCommand, "principal1_mail", DbType.String, this.principal1_mail);
			db.AddInParameter(dbCommand, "principal2", DbType.String, this.principal2);
			db.AddInParameter(dbCommand, "principal2_tel", DbType.String, this.principal2_tel);
			db.AddInParameter(dbCommand, "principal2_mobile", DbType.String, this.principal2_mobile);
			db.AddInParameter(dbCommand, "principal2_mail", DbType.String, this.principal2_mail);
			db.AddInParameter(dbCommand, "product_type", DbType.String, this.product_type);
			db.AddInParameter(dbCommand, "product_brand", DbType.String, this.product_brand);
			db.AddInParameter(dbCommand, "product_name", DbType.String, this.product_name);
			db.AddInParameter(dbCommand, "product_model", DbType.String, this.product_model);
			db.AddInParameter(dbCommand, "product_unit", DbType.String, this.product_unit);
			db.AddInParameter(dbCommand, "product_amount", DbType.String, this.product_amount);
			db.AddInParameter(dbCommand, "product_scheme", DbType.String, this.product_scheme);
			db.AddInParameter(dbCommand, "other_require", DbType.String, this.other_require);
			db.AddInParameter(dbCommand, "other_plan", DbType.String, this.other_plan);
			db.AddInParameter(dbCommand, "remark", DbType.String, this.remark);
			db.AddInParameter(dbCommand, "responser", DbType.String, this.responser);
			if (this.salestatus == null)
			{
			db.AddInParameter(dbCommand, "salestatus", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "salestatus", DbType.Int32, this.salestatus.Value);
			}
			if (this.saledatedate == null)
			{
			db.AddInParameter(dbCommand, "saledatedate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "saledatedate", DbType.DateTime, this.saledatedate.Value);
			}
			db.AddInParameter(dbCommand, "followup_1", DbType.String, this.followup_1);
			if (this.followup_1_time == null)
			{
			db.AddInParameter(dbCommand, "followup_1_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_1_time", DbType.DateTime, this.followup_1_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_1_user", DbType.String, this.followup_1_user);
			db.AddInParameter(dbCommand, "followup_2", DbType.String, this.followup_2);
			if (this.followup_2_time == null)
			{
			db.AddInParameter(dbCommand, "followup_2_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_2_time", DbType.DateTime, this.followup_2_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_2_user", DbType.String, this.followup_2_user);
			db.AddInParameter(dbCommand, "followup_3", DbType.String, this.followup_3);
			if (this.followup_3_time == null)
			{
			db.AddInParameter(dbCommand, "followup_3_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_3_time", DbType.DateTime, this.followup_3_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_3_user", DbType.String, this.followup_3_user);
			db.AddInParameter(dbCommand, "followup_4", DbType.String, this.followup_4);
			db.AddInParameter(dbCommand, "followup_4_time", DbType.String, this.followup_4_time);
			db.AddInParameter(dbCommand, "followup_4_user", DbType.String, this.followup_4_user);
			db.AddInParameter(dbCommand, "followup_5", DbType.String, this.followup_5);
			if (this.followup_5_time == null)
			{
			db.AddInParameter(dbCommand, "followup_5_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_5_time", DbType.DateTime, this.followup_5_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_5_user", DbType.String, this.followup_5_user);
			db.AddInParameter(dbCommand, "CreateBy", DbType.String, this.CreateBy);
			if (this.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, this.CreateDate.Value);
			}

			
			return	db.ExecuteNonQuery(dbCommand);

		}
		



		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public override int Update(SaleReportProcureEntity entity)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update Sale_Report_Procure set ");
			strSql.Append("[id]=@id,[company]=@company,[project]=@project,[address]=@address,[scope]=@scope,[tel]=@tel,[fax]=@fax,[mail]=@mail,[website]=@website,[principal1]=@principal1,[principal1_tel]=@principal1_tel,[principal1_mobile]=@principal1_mobile,[principal1_mail]=@principal1_mail,[principal2]=@principal2,[principal2_tel]=@principal2_tel,[principal2_mobile]=@principal2_mobile,[principal2_mail]=@principal2_mail,[product_type]=@product_type,[product_brand]=@product_brand,[product_name]=@product_name,[product_model]=@product_model,[product_unit]=@product_unit,[product_amount]=@product_amount,[product_scheme]=@product_scheme,[other_require]=@other_require,[other_plan]=@other_plan,[remark]=@remark,[responser]=@responser,[salestatus]=@salestatus,[saledatedate]=@saledatedate,[followup_1]=@followup_1,[followup_1_time]=@followup_1_time,[followup_1_user]=@followup_1_user,[followup_2]=@followup_2,[followup_2_time]=@followup_2_time,[followup_2_user]=@followup_2_user,[followup_3]=@followup_3,[followup_3_time]=@followup_3_time,[followup_3_user]=@followup_3_user,[followup_4]=@followup_4,[followup_4_time]=@followup_4_time,[followup_4_user]=@followup_4_user,[followup_5]=@followup_5,[followup_5_time]=@followup_5_time,[followup_5_user]=@followup_5_user,[CreateBy]=@CreateBy,[CreateDate]=@CreateDate ");

            strSql.Append(" where id=@id ");
            Database db = GetDatabase();
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "id", DbType.Int32, entity.id );
			db.AddInParameter(dbCommand, "company", DbType.String, entity.company);
			db.AddInParameter(dbCommand, "project", DbType.String, entity.project);
			db.AddInParameter(dbCommand, "address", DbType.String, entity.address);
			db.AddInParameter(dbCommand, "scope", DbType.String, entity.scope);
			db.AddInParameter(dbCommand, "tel", DbType.String, entity.tel);
			db.AddInParameter(dbCommand, "fax", DbType.String, entity.fax);
			db.AddInParameter(dbCommand, "mail", DbType.String, entity.mail);
			db.AddInParameter(dbCommand, "website", DbType.String, entity.website);
			db.AddInParameter(dbCommand, "principal1", DbType.String, entity.principal1);
			db.AddInParameter(dbCommand, "principal1_tel", DbType.String, entity.principal1_tel);
			db.AddInParameter(dbCommand, "principal1_mobile", DbType.String, entity.principal1_mobile);
			db.AddInParameter(dbCommand, "principal1_mail", DbType.String, entity.principal1_mail);
			db.AddInParameter(dbCommand, "principal2", DbType.String, entity.principal2);
			db.AddInParameter(dbCommand, "principal2_tel", DbType.String, entity.principal2_tel);
			db.AddInParameter(dbCommand, "principal2_mobile", DbType.String, entity.principal2_mobile);
			db.AddInParameter(dbCommand, "principal2_mail", DbType.String, entity.principal2_mail);
			db.AddInParameter(dbCommand, "product_type", DbType.String, entity.product_type);
			db.AddInParameter(dbCommand, "product_brand", DbType.String, entity.product_brand);
			db.AddInParameter(dbCommand, "product_name", DbType.String, entity.product_name);
			db.AddInParameter(dbCommand, "product_model", DbType.String, entity.product_model);
			db.AddInParameter(dbCommand, "product_unit", DbType.String, entity.product_unit);
			db.AddInParameter(dbCommand, "product_amount", DbType.String, entity.product_amount);
			db.AddInParameter(dbCommand, "product_scheme", DbType.String, entity.product_scheme);
			db.AddInParameter(dbCommand, "other_require", DbType.String, entity.other_require);
			db.AddInParameter(dbCommand, "other_plan", DbType.String, entity.other_plan);
			db.AddInParameter(dbCommand, "remark", DbType.String, entity.remark);
			db.AddInParameter(dbCommand, "responser", DbType.String, entity.responser);
			if (entity.salestatus == null)
			{
			db.AddInParameter(dbCommand, "salestatus", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "salestatus", DbType.Int32, entity.salestatus.Value);
			}
			if (entity.saledatedate == null)
			{
			db.AddInParameter(dbCommand, "saledatedate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "saledatedate", DbType.DateTime, entity.saledatedate.Value);
			}
			db.AddInParameter(dbCommand, "followup_1", DbType.String, entity.followup_1);
			if (entity.followup_1_time == null)
			{
			db.AddInParameter(dbCommand, "followup_1_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_1_time", DbType.DateTime, entity.followup_1_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_1_user", DbType.String, entity.followup_1_user);
			db.AddInParameter(dbCommand, "followup_2", DbType.String, entity.followup_2);
			if (entity.followup_2_time == null)
			{
			db.AddInParameter(dbCommand, "followup_2_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_2_time", DbType.DateTime, entity.followup_2_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_2_user", DbType.String, entity.followup_2_user);
			db.AddInParameter(dbCommand, "followup_3", DbType.String, entity.followup_3);
			if (entity.followup_3_time == null)
			{
			db.AddInParameter(dbCommand, "followup_3_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_3_time", DbType.DateTime, entity.followup_3_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_3_user", DbType.String, entity.followup_3_user);
			db.AddInParameter(dbCommand, "followup_4", DbType.String, entity.followup_4);
			db.AddInParameter(dbCommand, "followup_4_time", DbType.String, entity.followup_4_time);
			db.AddInParameter(dbCommand, "followup_4_user", DbType.String, entity.followup_4_user);
			db.AddInParameter(dbCommand, "followup_5", DbType.String, entity.followup_5);
			if (entity.followup_5_time == null)
			{
			db.AddInParameter(dbCommand, "followup_5_time", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "followup_5_time", DbType.DateTime, entity.followup_5_time.Value);
			}
			db.AddInParameter(dbCommand, "followup_5_user", DbType.String, entity.followup_5_user);
			db.AddInParameter(dbCommand, "CreateBy", DbType.String, entity.CreateBy);
			if (entity.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, entity.CreateDate.Value);
			}

			
			return	db.ExecuteNonQuery(dbCommand);

		}
		


		
		
		
		
		/// <summary>
        /// 对象实体绑定数据
		///生成构造为list的构造器
        /// </summary>
        private SaleReportProcureEntity ReaderBind(IDataReader dataReader,int seq)
        {
            ITOMMS.Entity.SaleReportProcureEntity entity = new ITOMMS.Entity.SaleReportProcureEntity();
			entity.SEQNO = seq;
            object obj;
			obj = dataReader["id"];
			 if (obj != null && obj != DBNull.Value)
			 {
			 entity.id = (int)obj;
			 }
			 entity.company= dataReader["company"].ToString();
			 entity.project= dataReader["project"].ToString();
			 entity.address= dataReader["address"].ToString();
			 entity.scope= dataReader["scope"].ToString();
			 entity.tel= dataReader["tel"].ToString();
			 entity.fax= dataReader["fax"].ToString();
			 entity.mail= dataReader["mail"].ToString();
			 entity.website= dataReader["website"].ToString();
			 entity.principal1= dataReader["principal1"].ToString();
			 entity.principal1_tel= dataReader["principal1_tel"].ToString();
			 entity.principal1_mobile= dataReader["principal1_mobile"].ToString();
			 entity.principal1_mail= dataReader["principal1_mail"].ToString();
			 entity.principal2= dataReader["principal2"].ToString();
			 entity.principal2_tel= dataReader["principal2_tel"].ToString();
			 entity.principal2_mobile= dataReader["principal2_mobile"].ToString();
			 entity.principal2_mail= dataReader["principal2_mail"].ToString();
			 entity.product_type= dataReader["product_type"].ToString();
			 entity.product_brand= dataReader["product_brand"].ToString();
			 entity.product_name= dataReader["product_name"].ToString();
			 entity.product_model= dataReader["product_model"].ToString();
			 entity.product_unit= dataReader["product_unit"].ToString();
			 entity.product_amount= dataReader["product_amount"].ToString();
			 entity.product_scheme= dataReader["product_scheme"].ToString();
			 entity.other_require= dataReader["other_require"].ToString();
			 entity.other_plan= dataReader["other_plan"].ToString();
			 entity.remark= dataReader["remark"].ToString();
			 entity.responser= dataReader["responser"].ToString();
			 obj=dataReader["salestatus"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.salestatus= (int)obj;
			}
			 obj=dataReader["saledatedate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.saledatedate= (DateTime)obj;
			}
			 entity.followup_1= dataReader["followup_1"].ToString();
			 obj=dataReader["followup_1_time"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.followup_1_time= (DateTime)obj;
			}
			 entity.followup_1_user= dataReader["followup_1_user"].ToString();
			 entity.followup_2= dataReader["followup_2"].ToString();
			 obj=dataReader["followup_2_time"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.followup_2_time= (DateTime)obj;
			}
			 entity.followup_2_user= dataReader["followup_2_user"].ToString();
			 entity.followup_3= dataReader["followup_3"].ToString();
			 obj=dataReader["followup_3_time"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.followup_3_time= (DateTime)obj;
			}
			 entity.followup_3_user= dataReader["followup_3_user"].ToString();
			 entity.followup_4= dataReader["followup_4"].ToString();
			 entity.followup_4_time= dataReader["followup_4_time"].ToString();
			 entity.followup_4_user= dataReader["followup_4_user"].ToString();
			 entity.followup_5= dataReader["followup_5"].ToString();
			 obj=dataReader["followup_5_time"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.followup_5_time= (DateTime)obj;
			}
			 entity.followup_5_user= dataReader["followup_5_user"].ToString();
			 entity.CreateBy= dataReader["CreateBy"].ToString();
			 obj=dataReader["CreateDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateDate= (DateTime)obj;
			}

            return entity;
        }
		
		
				/// <summary>
        /// 对象实体绑定数据
		///生成构造为list的构造器
        /// </summary>
        private SaleReportProcureEntity ReaderBind(IDataReader dataReader)
        {
            ITOMMS.Entity.SaleReportProcureEntity entity = new ITOMMS.Entity.SaleReportProcureEntity();
			object obj;
			obj = dataReader["id"];
			 if (obj != null && obj != DBNull.Value)
			 {
			 entity.id = (int)obj;
			 }
			 entity.company= dataReader["company"].ToString();
			 entity.project= dataReader["project"].ToString();
			 entity.address= dataReader["address"].ToString();
			 entity.scope= dataReader["scope"].ToString();
			 entity.tel= dataReader["tel"].ToString();
			 entity.fax= dataReader["fax"].ToString();
			 entity.mail= dataReader["mail"].ToString();
			 entity.website= dataReader["website"].ToString();
			 entity.principal1= dataReader["principal1"].ToString();
			 entity.principal1_tel= dataReader["principal1_tel"].ToString();
			 entity.principal1_mobile= dataReader["principal1_mobile"].ToString();
			 entity.principal1_mail= dataReader["principal1_mail"].ToString();
			 entity.principal2= dataReader["principal2"].ToString();
			 entity.principal2_tel= dataReader["principal2_tel"].ToString();
			 entity.principal2_mobile= dataReader["principal2_mobile"].ToString();
			 entity.principal2_mail= dataReader["principal2_mail"].ToString();
			 entity.product_type= dataReader["product_type"].ToString();
			 entity.product_brand= dataReader["product_brand"].ToString();
			 entity.product_name= dataReader["product_name"].ToString();
			 entity.product_model= dataReader["product_model"].ToString();
			 entity.product_unit= dataReader["product_unit"].ToString();
			 entity.product_amount= dataReader["product_amount"].ToString();
			 entity.product_scheme= dataReader["product_scheme"].ToString();
			 entity.other_require= dataReader["other_require"].ToString();
			 entity.other_plan= dataReader["other_plan"].ToString();
			 entity.remark= dataReader["remark"].ToString();
			 entity.responser= dataReader["responser"].ToString();
			 obj=dataReader["salestatus"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.salestatus= (int)obj;
			}
			 obj=dataReader["saledatedate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.saledatedate= (DateTime)obj;
			}
			 entity.followup_1= dataReader["followup_1"].ToString();
			 obj=dataReader["followup_1_time"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.followup_1_time= (DateTime)obj;
			}
			 entity.followup_1_user= dataReader["followup_1_user"].ToString();
			 entity.followup_2= dataReader["followup_2"].ToString();
			 obj=dataReader["followup_2_time"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.followup_2_time= (DateTime)obj;
			}
			 entity.followup_2_user= dataReader["followup_2_user"].ToString();
			 entity.followup_3= dataReader["followup_3"].ToString();
			 obj=dataReader["followup_3_time"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.followup_3_time= (DateTime)obj;
			}
			 entity.followup_3_user= dataReader["followup_3_user"].ToString();
			 entity.followup_4= dataReader["followup_4"].ToString();
			 entity.followup_4_time= dataReader["followup_4_time"].ToString();
			 entity.followup_4_user= dataReader["followup_4_user"].ToString();
			 entity.followup_5= dataReader["followup_5"].ToString();
			 obj=dataReader["followup_5_time"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.followup_5_time= (DateTime)obj;
			}
			 entity.followup_5_user= dataReader["followup_5_user"].ToString();
			 entity.CreateBy= dataReader["CreateBy"].ToString();
			 obj=dataReader["CreateDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateDate= (DateTime)obj;
			}

            return entity;
        }
		
		
		
		 #endregion
		
	}
}
